<!DOCTYPE html>
<html lang="en">
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
		<title>获取推广资格</title>
		<link rel="stylesheet" type="text/css" href="css/public.css"/>
	</head>
	<style type="text/css">
		body{font-size: 0.3rem;}
		.cont{height: 100%;width: 100%;}
		.cont img{width: 7.5rem;height: auto;display: block;}
		.agreement{height: 0.87rem;width: 7.5rem;background: #fff;}
		.agreement p{margin-right: 0.05rem;}
		.agreement a{color: #000;}
		.agreement a:hover{text-decoration: underline;}
		.agrecont{line-height: 0.87rem;height: 0.87rem;}
		.agrecont img{width:0.4rem;height: auto;margin-right: -0.4rem;display: block;}
		.hookbox{height: 0.35rem;width: 0.35rem;border-radius: 4px;border: solid #000 1px;margin-right: 0.1rem;}
		.footer{height: 1.4rem;width: 100%;color: #fff;}
		.price{height: 1.4rem;width: 4.1rem;background: #fdc741;}
		.price-font{font-size: 0.38rem;margin-right: 0.1rem;}
		.price-original{font-size: 0.24rem;text-decoration: line-through;}
		.submit{height: 1.4rem;width: 3.4rem;background: #eb603f;font-size: 0.4rem;}
		.submit a{color: #fff;}
	</style>
	<body>
		<div class="cont">
			<img src="img/extension.png"/>
		</div>
		<div class="agreement">
			<div class="agrecont flex flex-pack-center flex-align-center">
				<img src="img/gou_05.png" data-key="1"/>
				<div class="hookbox"></div>
				<p>我已阅读并同意</p>
				<a href="./Protocol_details.html">《优鸟钱包推广商服务协议》</a>
			</div>
		</div>
		<div class="footer flex">
			<div class="price flex flex-pack-center flex-align-center">
				<p class="price-font">价格498元</p>
				<p class="price-original">原价3980元</p>
			</div>
			<div class="submit flex flex-align-center flex-pack-center">
				<p>立即加入</p>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="js/rem.js"></script>
	<script type="text/javascript" src="js/zepto.js"></script>
	<script type="text/javascript" src="js/layer.js"></script>
	<script type="text/javascript">
		$(function(){
			var code = GetQueryString('code');
			var userid = GetQueryString('userid');
			if(userid == null){//如果获取userid为空，则默认为2000
				userid = 2000;
			}
			if(code == 1){
				$(".submit p").text("立即加入");
			}else if(code == 0){
				$(".submit").html('<a onclick="Vim.Purchase()">立即购买</a>');
			}else if(code == 2){
				$(".submit").html('<a onclick="Vim.Already()">已购买</a>');
			}
			$(".hookbox").on("click",function(){
			$('.agrecont img').show().attr('data-key',1);
		});
		$(".agrecont img").on('click',function(){
			$(this).hide().attr('data-key',0);
		});
		$(".submit p").click(function(){
			if($('.agrecont img').data('key')==1){
				jump('http://www.uniao.me/share/index.htm?reCode='+ userid +'&topUserId=2000&from=singlemessage&isappinstalled=1');
			}else{
				  //提示
				  layer.open({
				    content: '请仔细阅读推广商服务协议'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}
		});
		})
		//接受url所传参数
		function GetQueryString(name){
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if(r != null)
				return unescape(r[2]);
			return null;
		};
		//页面跳转
		function jump(url){
			window.location.href = url;
		};
		var Vim = {
			Purchase: function(){//立即购买响应事件
			//To Do ios&adriod
			if($('.agrecont img').data('key')==1){
				window.largePay.promoterBuy();	
			}else{
				  //提示
				  layer.open({
				    content: '请仔细阅读推广商服务协议'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}
			},
			Already: function(){//已购买提示响应事件
			if($('.agrecont img').data('key')==1){
				  //提示
				  layer.open({
				    content: '已购买，无需重复购买'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}else{
				  //提示
				  layer.open({
				    content: '请仔细阅读推广商服务协议'
				    ,skin: 'msg'
				    ,time: 2 //2秒后自动关闭
				  });
			}
			}
		}
	</script>
</html>